<?php

namespace app\models;

use Yii;
use app\components\behaviors\CreatorBehaviors;


/**
 * This is the model class for table "kd_parents".
 *
 * @property integer $jz_id
 * @property string $jz_name
 * @property string $jz_wxm
 * @property string $jz_wxtx
 * @property integer $xs_id
 * @property string $xs_gx
 * @property integer $yey_id
 * @property integer $bj_id
 * @property string $xiugai_shijian
 * @property string $xiugai_ren
 */
class Parents extends \yii\db\ActiveRecord
{
    public function beHaviors(){
        return [
            [
                'class' => \app\components\behaviors\DatetimeBehavior::className(),
                'updateDate' => 'xiugai_shijian',
            ],
            [
                'class' => \app\components\behaviors\CreatorBehaviors::className(),
                'fieldName' => 'xiugai_ren',
            ],
            [
                'class' => \app\components\behaviors\LogBehavior::className(),
                'tableName' => '家长',
                'attributeValue' => 'jz_name',
            ],
            [
                'class'=>\app\components\behaviors\RecoverBehavior::className(),
            ],
        ];
    }
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'kd_parents';
    }


    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['jz_name', 'xs_id', 'xs_gx', 'yey_id', 'bj_id'], 'required'],
            [['xs_id', 'yey_id', 'bj_id'], 'integer'],
            [['xiugai_shijian'], 'safe'],
            [['jz_name'], 'string', 'max' => 20],
            [['jz_wxm'], 'string', 'max' => 30],
            [['jz_wxtx', 'xiugai_ren'], 'string', 'max' => 50],
            [['xs_gx'], 'string', 'max' => 10],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'jz_id' => '家长序号',
            'jz_name' => '家长姓名',
            'jz_wxm' => '家长微信名',
            'jz_wxtx' => '家长微信头像',
            'xs_id' => '对应的学生序号',
            'xs_gx' => '和学生的关系',
            'yey_id' => '所属幼儿园序号',
            'bj_id' => '所属班级序号',
            'xiugai_shijian' => '学生最后修改时间',
            'xiugai_ren' => '修改人',
        ];
    }
}
